Holds information about a mesh. Used as a basis to render 3d models.
More...
Holds information about a mesh. Used as a basis to render 3d models.
See MeshManager::createOrRetrieve() to allocate new instances. This API will evolve and be redesigned soon. It is advised to reduce the number of calls made.
◆ Mesh()
nkGraphics::Mesh::Mesh |
( |
| ) |
|
◆ ~Mesh()
virtual nkGraphics::Mesh::~Mesh |
( |
| ) |
|
|
virtual |
◆ resetCpuBuffers()
void nkGraphics::Mesh::resetCpuBuffers |
( |
| ) |
|
Resets the cpu buffers and free the memory allocated.
Can be used after the mesh is fully loaded to free CPU memory.
◆ fillPackedFromUnpacked()
bool nkGraphics::Mesh::fillPackedFromUnpacked |
( |
| ) |
|
Fills the packed buffers from the unpacked buffers. This is done automatically when loading.
- Returns
- If the filling went well (true) or not (false).
◆ computeBounds()
void nkGraphics::Mesh::computeBounds |
( |
| ) |
|
Computes the bounds of the mesh. Done during loading, if the auto generation is enabled.
◆ getVertexBufferCount()
virtual int nkGraphics::Mesh::getVertexBufferCount |
( |
| ) |
const |
|
virtual |
- Returns
- The vertex buffer count. Currently, only one buffer is used for a mesh.
◆ getVertexCount()
virtual unsigned int nkGraphics::Mesh::getVertexCount |
( |
| ) |
const |
|
virtual |
- Returns
- The number of vertices.
◆ getIndexCount()
virtual unsigned int nkGraphics::Mesh::getIndexCount |
( |
| ) |
const |
|
virtual |
- Returns
- The number of indices.
◆ getId()
unsigned int nkGraphics::Mesh::getId |
( |
| ) |
const |
- Returns
- The id of the mesh.
◆ getPackedBufferReady()
bool nkGraphics::Mesh::getPackedBufferReady |
( |
| ) |
const |
- Returns
- Whether the packed CPU buffer is ready (true) or not (false).
◆ getAutoComputeBounds()
bool nkGraphics::Mesh::getAutoComputeBounds |
( |
| ) |
const |
- Returns
- Whether the mesh auto-computes its bounds (true) or not (false).
◆ getBounds()
- Returns
- The bounds of the meshes.
◆ setVertexCount()
void nkGraphics::Mesh::setVertexCount |
( |
int |
value | ) |
|
Sets the number of vertices of the mesh.
- Parameters
-
value | The number of vertices to use. |
◆ setIndexCount()
void nkGraphics::Mesh::setIndexCount |
( |
int |
value | ) |
|
Sets the number of indices of the mesh.
- Parameters
-
value | The number of indices to use. |
◆ setId()
void nkGraphics::Mesh::setId |
( |
unsigned int |
value | ) |
|
Sets the id of the mesh. Used internally for tracking.
- Parameters
-
◆ setPackedBufferReady()
void nkGraphics::Mesh::setPackedBufferReady |
( |
bool |
value | ) |
|
Sets whether the packed buffer is ready to use.
Can be used to fill directly the packed buffer and avoid the packing step.
- Parameters
-
value | If the packed buffer is ready (true) or not (false). |
◆ setAutoComputeBounds()
void nkGraphics::Mesh::setAutoComputeBounds |
( |
bool |
value | ) |
|
Sets whether the loading step should compute the bounds of the mesh.
- Parameters
-
value | If the bounds should be computed (true) or not (false). |
◆ getCurrentVertexArray()
VertexComposition::VertexComponent* nkGraphics::Mesh::getCurrentVertexArray |
( |
| ) |
const |
- Returns
- Currently allocated vertex array, unpacked.
◆ getNewVertexArray()
VertexComposition::VertexComponent* nkGraphics::Mesh::getNewVertexArray |
( |
unsigned int |
requestedPointNumber | ) |
|
Creates a new unpacked vertex array of requested size, and returns it for populating.
- Parameters
-
requestedPointNumber | The number of vertices the array should feature. |
◆ getCurrentVertexPackedArray()
float* nkGraphics::Mesh::getCurrentVertexPackedArray |
( |
| ) |
const |
- Returns
- Currently allocated vertex array, packed.
◆ getNewVertexPackedArray()
float* nkGraphics::Mesh::getNewVertexPackedArray |
( |
unsigned int |
requestedPointNumber | ) |
|
Creates a new packed vertex array of requested size, and returns it for populating.
- Parameters
-
requestedPointNumber | The number of vertices the array should feature. Final size will be computed according to the composition, be sure it is updated. |
◆ getCurrentIndexArray()
unsigned int* nkGraphics::Mesh::getCurrentIndexArray |
( |
| ) |
const |
- Returns
- Currently allocated index array.
◆ getNewIndexArray()
unsigned int* nkGraphics::Mesh::getNewIndexArray |
( |
unsigned int |
requestedIndexNumber | ) |
|
Creates a new index array of requested size, and returns it for populating.
- Parameters
-
requestedIndexNumber | The number of vertices the array should feature. |
◆ setVertexComposition()
Sets the vertex composition to use.
- Parameters
-
compo | The composition to use. |
◆ getCurrentVertexComposition()
- Returns
- The currently used vertex composition.
◆ prepareForGeometryStream()
virtual void nkGraphics::Mesh::prepareForGeometryStream |
( |
| ) |
|
|
pure virtual |
Allows the mesh to be used as an output for a geometry stream.
◆ freeShadowBuffers()
virtual void nkGraphics::Mesh::freeShadowBuffers |
( |
bool |
cleanUnpacked, |
|
|
bool |
cleanPacked |
|
) |
| |
|
virtual |
Frees the shadow buffers, aka the CPU buffers.
Can be called after loading the mesh to free requested memory.
- Parameters
-
cleanUnpacked | If the unpacked buffer should be cleaned. |
cleanPacked | If the packed buffer should be cleaned. |
◆ generateTangent()
void nkGraphics::Mesh::generateTangent |
( |
| ) |
|
Utility for generating the tangents out of available information in the cpu buffer.
◆ generateBinormal()
void nkGraphics::Mesh::generateBinormal |
( |
| ) |
|
Utility for generating the binormals out of available information in the cpu buffer.
◆ exportClassToTree()
virtual void nkGraphics::Mesh::exportClassToTree |
( |
nkExport::Node * |
rootNode | ) |
|
|
overridevirtual |
Basic exporting capabilities.
- Parameters
-
rootNode | The tree to export to. |
Implements nkExport::Exportable.
◆ importClassFromTree()
virtual void nkGraphics::Mesh::importClassFromTree |
( |
nkExport::Node * |
rootNode | ) |
|
|
overridevirtual |
Basic importing capabilities.
- Parameters
-
rootNode | The tree to import from. |
Implements nkExport::Exportable.
The documentation for this class was generated from the following file:
- Documentation/Headers/NilkinsGraphics/Meshes/Mesh.h